<template>
  <Dialog title="详情" v-model="dialogVisible" width="80%" append-to-body>
    <Info :data="data">
      <template #header>
        <div class="card-header">
          <CardTitle title="审核信息" />
        </div>
      </template>
    </Info>
    <!-- <template #footer>
      <el-button @click="openForm(data.id)" type="primary">审核</el-button>
      <el-button @click="dialogVisible = false">取 消</el-button>
    </template> -->
  </Dialog>

  <!-- 表单弹窗：添加/修改 -->
  <Form ref="formRef" />
</template>

<script setup lang="ts">
import * as TradeRefundApi from '@/api/blind/tradeRefund'
import Info from './components/Info.vue'
import Form from './Form.vue'

const dialogVisible = ref(false) // 弹窗的是否展示
const data = ref<TradeRefundApi.TradeRefundVO>({} as TradeRefundApi.TradeRefundVO)

/** 打开弹窗 */
const open = async (id?: number) => {
  dialogVisible.value = true
  // 修改时，设置数据
  if (id) {
    data.value = await TradeRefundApi.getTradeRefund(id)
  }
}
defineExpose({ open }) // 提供 open 方法，用于打开弹

/** 添加/修改操作 */
const formRef = ref()
const openForm = (id?: number) => {
  formRef.value.open(id)
}
</script>
<style scoped lang="scss">
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
